<!--
 <%= htmlWebpackPlugin.options.info %>
 -->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport"
        content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no" />
    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/antd/4.24.15/antd.min.css">
    <link rel="stylesheet" type="text/css" href="./css/widget-main.css">
    <title>
        <%= htmlWebpackPlugin.options.title %>
    </title>
    <script src="./js/config.js"></script>
    <script src="./js/adapter.js"></script>
    <script src="./js/socket.io.js"></script>
    <script src="./js/ivcs.js"></script>
    <script src="./js/iconfont.js"></script>
    <script src="./js/ZcoIM.js"></script>
    <script src="./js/dstpSecurityPage-1.1.3.umd.js"></script>
    <script src="./index.js"></script>



<body>
    <div id="agent-widget-root" style="height: 100%; width: 100%; background-color: #fafbfc;"></div>
</body>
<script>
    // 初始化参数
    const { configure } = AgentServer.Agent;
    configure.setServiceUrl(loginUrl);
    configure.setDefaultMediaOptions(defaultMediaOptions);
    configure.setCountlyParam({ appkey: '', host: '' });
    configure.setCustomerUrl(customerUrl);
    configure.setPublicKey(publicKey);
    configure.setFormUrl(formUrl);
    configure.setResourceOriginUrlDomain(resourceOriginUrlDomain);
    configure.setResourceReplaceUrlDomain(resourceReplaceUrlDomain);
    configure.setUrlMapping(typeof urlMapping === 'undefined' ? {} : urlMapping);
    AgentServer.Agent.setLogLevel(logLevel);
    configure.setDefaultMediaOptions(defaultMediaOptions);
    configure.setMaxUploadFileSize(maxUploadFileSize);
    if (whiteboardInfo && whiteboardInfo.hostName && whiteboardInfo.whiteboardPath) {
        configure.setWhiteBoardInfo(whiteboardInfo);
    } else {
        configure.setWhiteBoardInfo({ hostName: loginUrl, whiteboardPath: '/static/whiteboard' });
    }
    // 初始化系统
    AgentServer.Agent.init(loginUrl, {
        isCallProgress: true,
        isImagePreview: true,
        userInfoVisible: true,
        managementMenuVisible: true,
        watermarkConfigVisible: true,
        languageConfigVisible: true,
        acceptCallConfigVisible: true,
        chatBoxVisible: true,
        layoutConfigVisible: true,
        bizPannelVisible: true,
        headerMenus: [
            { label: '通话服务', i18nKey: 'call-service', key: 'sessionService' },
            { label: '在线坐席管理', i18nKey: 'online-agent-management', key: 'agentManagement' }
        ], // 头部 Tab 标签
        isRecord: window.isRecord
    });
    AgentServer.Agent.addEventListener(resp => {
        if (resp.event === 'LOGIN') {
            if (resp.data.code === 10000) {
                // 登录成功，创建视图
                AgentServer.Agent.createView('agent-widget-root');
                AgentServer.render();
            } else {
                AgentServer.destroy();
            }
        }
    })
    AgentServer.Agent.setLoginData({ username: 'A001', password: '111111', org: '1' });
    AgentServer.Agent.loginSystem();
</script>

</html>
